@@ -78,10 +78,10 @@ angular.module('codexApp.index', [])
|
||
| 78 | 78 |
$rootScope.$on('file-service:files-loaded', function(){
|
| 79 | 79 |
if(!$scope.$$phase) {
|
| 80 | 80 |
$scope.$apply(function(){
|
| 81 |
- //$scope.itemSpacing(); |
|
| 81 |
+ $scope.itemSpacing(); |
|
| 82 | 82 |
}); |
| 83 | 83 |
} else {
|
| 84 |
- //$scope.itemSpacing(); |
|
| 84 |
+ $scope.itemSpacing(); |
|
| 85 | 85 |
} |
| 86 | 86 |
}) |
| 87 | 87 |
|
@@ -101,9 +101,12 @@ angular.module('codexApp.index', [])
|
||
| 101 | 101 |
}) |
| 102 | 102 |
|
| 103 | 103 |
$scope.itemSpacing = function(){
|
| 104 |
- var items = document.getElementsByClassName("file-view-item");
|
|
| 104 |
+ //var html_items = document.getElementsByClassName("file-view-item");
|
|
| 105 |
+ //var items = [].slice.call(html_items); |
|
| 106 |
+ var items = HTMLNodesToArray('grid', 'li');
|
|
| 105 | 107 |
for (var i = 0; i < items.length; i++) {
|
| 106 |
- items[i].style.margin = "15px"; |
|
| 108 |
+ items[i].style.margin = "55px"; |
|
| 109 |
+ console.log(item[i]); |
|
| 107 | 110 |
} |
| 108 | 111 |
} |
| 109 | 112 |
|
@@ -144,4 +147,27 @@ angular.module('codexApp.index', [])
|
||
| 144 | 147 |
} })); |
| 145 | 148 |
menu.popup(currentWindow); |
| 146 | 149 |
} |
| 150 |
+ |
|
| 151 |
+ var HTMLNodesToArray = function (reference, elems) {
|
|
| 152 |
+ reference = document.getElementById(reference); |
|
| 153 |
+ console.log(reference); |
|
| 154 |
+ //elems = elems || '*'; |
|
| 155 |
+ //var nodes = []; |
|
| 156 |
+ //var elements = reference.getElementsByClassName(elems); |
|
| 157 |
+ var elements = angular.element(document.querySelector( '.file-view-item' )); |
|
| 158 |
+ console.log(elements); |
|
| 159 |
+ // var i; |
|
| 160 |
+ // nodes = Array.prototype.slice.call(elements); |
|
| 161 |
+ // console.log( Array.isArray(elements)) |
|
| 162 |
+ // console.log( Array.isArray(nodes)) |
|
| 163 |
+ // console.log(nodes) |
|
| 164 |
+ // var len = elements.length; |
|
| 165 |
+ // console.log(len) |
|
| 166 |
+ // for(i = 0; i< len; i += 1) {
|
|
| 167 |
+ // var node = elements[i]; |
|
| 168 |
+ // nodes.push(node); |
|
| 169 |
+ // } |
|
| 170 |
+ return elements; |
|
| 171 |
+ } |
|
| 172 |
+ |
|
| 147 | 173 |
}]); |
@@ -9,6 +9,12 @@ Links, snipets and references for the Codex App. |
||
| 9 | 9 |
* [Mansonary](http://masonry.desandro.com/) - Cascading grid layout library |
| 10 | 10 |
* [Wavesurfer.js](http://wavesurfer-js.org/) - Web Audio Waveform Visualizer |
| 11 | 11 |
* [Cheerio](https://github.com/cheeriojs/cheerio) - Fast, flexible, and lean implementation of core jQuery designed specifically for the server |
| 12 |
+* [angular-inview](https://github.com/thenikso/angular-inview) - AngularJS directive to check if a DOM element is in the browser viewport. |
|
| 13 |
+ |
|
| 14 |
+## Reading |
|
| 15 |
+ |
|
| 16 |
+* [How do Promises Work?](http://robotlolita.me/2015/11/15/how-do-promises-work.html) |
|
| 17 |
+* [From Karma to Mocha, with a taste of jsdom](https://medium.com/podio-engineering-blog/from-karma-to-mocha-with-a-taste-of-jsdom-c9c703a06b21#.3gy10vj6i) |
|
| 12 | 18 |
|
| 13 | 19 |
## List folder and files |
| 14 | 20 |
|
@@ -101,7 +101,7 @@ code {
|
||
| 101 | 101 |
padding-top: 10px; |
| 102 | 102 |
} |
| 103 | 103 |
|
| 104 |
-.file-view ul li {
|
|
| 104 |
+.file-view-item {
|
|
| 105 | 105 |
list-style: none; |
| 106 | 106 |
padding: 10px; |
| 107 | 107 |
margin: 10px; |